<cfcomponent displayname="FusecacheCacheBoxWrapper" output="false" hint="">
	
	<cfproperty name="oCacheBoxAgent" type="cachebox.cacheboxagent">
	
	<!--- init() --->
	<cffunction name="init" access="public">
		<cfargument name="componentPath" type="string" required="true" />
		<cfargument name="agentname" type="string" required="true" hint="uniquely identifies this cache agent for analysis and configuration" /> />
		<cfargument name="context" type="string" required="false" default="application" hint="application, server or cluster - indicates the context in which the created cache is relevant" />
		<cfargument name="evict" type="string" required="false" default="auto" hint="none, auto, fresh, perf, idle:x, age:x, LRU:x, LFU:x or FIFO:x - indicates if objects in this cache are allowed to expire and optionally the priority of expiration" />
		<cfargument name="cacheService" type="any" required="false" default="" hint="allows the caching service to be managed by an IoC framework or for it to be stubbed for testing purposes" />
		<cfargument name="applicationName" type="string" required="false" default="#application.applicationName#" hint="indicates the application to which this cache belongs - ignored for agents in the cluster or server context" />
		
		<!--- Create CacheBox Agent instance --->		
		<cfset this.oCacheBoxAgent = CreateObject("component","#arguments.componentPath#").init(arguments.agentname, arguments.context, arguments.evict, arguments.cacheService, arguments.applicationName) />
		
		<cfreturn this />
	</cffunction>
	
	
	<!--- getAgent() --->
	<cffunction name="getAgent" access="public" output="false" returntype="cachebox.cacheboxagent" hint="">
		<cfreturn this.oCacheBoxAgent />
	</cffunction>
	
	
	<!--- get() --->
	<cffunction name="get" access="public" output="false" returntype="any" hint="">
		<cfargument name="key" type="string" required="true" />
		<cfset var local = {} />
		<cfset local.data = this.oCacheBoxAgent.fetch(arguments.key) />
		<cfreturn local.data.content />	
	</cffunction>
	
	
	<!--- set() --->
	<cffunction name="set" access="public" output="false" returntype="boolean" hint="">
		<cfargument name="key" type="string" required="true" />
		<cfargument name="value" type="any" required="true" />
		<cfargument name="expiry" type="numeric" required="false" default="0" />
		<cfset this.oCacheBoxAgent.store(arguments.key, arguments.value, createTimeSpan(0,0,0,arguments.expiry))>
		<cfreturn true />;
	</cffunction>
	
</cfcomponent>